package com.example.batalhanaval;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class HomeActivity extends Activity implements OnClickListener{

	TextView txtNome, txtPontuacao, txtNomeHome, txtPontosHome;
	Button btnCancel, btnStart, btnRanking;
	Player player;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_home);

		player = (Player)getIntent().getSerializableExtra("player");

		txtNome = (TextView)findViewById(R.id.textViewNomeHome);
		txtNome.setText(player.getNome());
		txtPontuacao = (TextView)findViewById(R.id.textViewPonto);
		txtPontuacao.setText(String.valueOf(player.getPontuacao()));
		txtNomeHome = (TextView)findViewById(R.id.textViewHome);
		txtNomeHome.setText(R.string.welcome);
		txtPontosHome = (TextView)findViewById(R.id.textViewPontoHome);
		txtPontosHome.setText(R.string.msgpontosHome);

		btnCancel = (Button)findViewById(R.id.btnCancelHome);
		btnCancel.setOnClickListener(this);
		btnStart = (Button)findViewById(R.id.btnStart);
		btnStart.setOnClickListener(this);
		btnRanking = (Button)findViewById(R.id.btnRanking);
		btnRanking.setOnClickListener(this);

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.home, menu);
		return true;
	}

	@Override
	public void onClick(View v) {
		
		Intent it;
		
		switch(v.getId())
		{
		case R.id.btnCancelHome:
			finish();
			break;
			
		case R.id.btnRanking:
			it = new Intent(this, ListaJogadoresActivity.class);
			startActivity(it);
			break;
			
		case R.id.btnStart:
			
			//chamar tela de procura de aparelhos
			break;
		}


	}

}
